package encrypt

import (
	"strings"

	"github.com/urfave/cli/v2"
)

func NewAPP(method string, ctx *cli.Context) *APP {
	return &APP{
		config: ctx.String("config"),
		method: method,
		data:   ctx.Args().Slice(),
	}
}

type APP struct {
	config string
	method string
	data   []string
}

func (a *APP) Run() {
	cols := strings.Split(a.method, ".")
	switch cols[0] {
	case "sm4":
		sm4 := NewSM4(a.config, cols[1], a.data)
		sm4.handle()
	}
}
